<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head th:replace="common/layout :: common_header(~{::title},~{::link})">
    <title>修改用户</title>
    <link rel="stylesheet" th:href="@{/ace/plugins/chosen/chosen.min.css}" />
</head>
<body>
<div class="main-container">
    <div class="main-content-inner">
        <div class="page-content">

            <form class="form-horizontal" role="form" id="clientYxAddForm"
                  method="post" th:action="@{/sys/client/updateyx}">
                <input id="id" name="id" type="hidden" th:value="${sysClientYx.id}" />
                <input id="id" name="id" type="hidden" th:value="${sysClientYx.clientid}" />
                    <!--<input id="companyId" name="companyId" type="hidden" th:value="${user.companyId}" /> <input-->
                    <!--id="officeId" name="officeId" type="hidden" th:value="${user.officeId}"  />-->
                <table
                        class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
                    <tr>
                        <td class="width-15 active"><label
                                class="pull-right  control-label">头像</label></td>
                        <td><span class="profile-picture">

						<img id="avatar" onclick="fileSelect();" class="" alt="头像" th:src="(${sysClientYx.photo=='0'})?(@{/ace/avatars/profile-pic.jpg}):(@{/sys/showFile/}+${sysClientYx.photo})" style="display: block;" width="60">
						</span><input type="file" id="photoImg" accept="image/*" name="file" onchange="fileSelected();" style="display:none;">
                            <input type="button" onclick="fileSelect()" value="选择"> <input type="button" onclick="clearfileSelect()" value="清除">
                        </td>
                    </tr>
                    <tr>

                        <td class="width-15 active"><label
                                class="pull-right  control-label">年龄</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="nianling" name="nianling" type="text" placeholder="请输入年龄" th:value="${sysClientYx.nianling}"
                                                     /></td>
                        <td class="width-15 active"><label
                                class="pull-right  control-label">身高</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="shengao" name="shengao" type="text" placeholder="请输入身高" th:value="${sysClientYx.shengao}"
                                                     /></td>
                    </tr>
                    <tr>
                        <td class="width-15 active"><label
                                class="pull-right  control-label">体重</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="tizhong" name="tizhong" type="text" placeholder="请输入体重" th:value="${sysClientYx.tizhong}"
                                                     /></td>
                        <td class="width-15 active"><label
                                class="pull-right  control-label">学历</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="xueli" name="xueli" type="text" placeholder="请输入学历" th:value="${sysClientYx.xueli}"
                                                     /></td>

                    </tr>
                    <tr>

                        <td class="width-15 active"><label
                                class="pull-right  control-label">工作</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="gongzuo" name="gongzuo" type="text" placeholder="请输入工作" th:value="${sysClientYx.gongzuo}"
                                                     /></td>
                        <td class="width-15 active"><label
                                class="pull-right  control-label">职位</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="zhiwei" name="zhiwei" type="text" placeholder="请输入职位" th:value="${sysClientYx.zhiwei}"
                                                     /></td>

                    </tr>

                    <tr>

                        <td class="width-15 active"><label
                                class="pull-right  control-label">性格</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="xingge" name="xingge" type="text" placeholder="请输入性格" th:value="${sysClientYx.xingge}"
                                                     /></td>
                        <td class="width-15 active"><label
                                class="pull-right  control-label">喜好</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="xihao" name="xihao" type="text" placeholder="请输入喜好" th:value="${sysClientYx.xihao}"
                                                     /></td>

                    </tr>


                    <tr>

                        <td class="width-15 active"><label
                                class="pull-right  control-label">婚姻</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="hunyin" name="hunyin" type="text" placeholder="请输入婚姻" th:value="${sysClientYx.hunyin}"
                                                     /></td>
                        <td class="width-15 active"><label
                                class="pull-right  control-label">收入</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="shouru" name="shouru" type="text" placeholder="请输入收入" th:value="${sysClientYx.shouru}"
                                                     /></td>

                    </tr>
                    <tr>

                        <td class="width-15 active"><label
                                class="pull-right  control-label">居住地点</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="juzhudidian" name="juzhudidian" type="text" placeholder="请输入居住地点" th:value="${sysClientYx.juzhudidian}"
                                                     /></td>

                        <td class="width-15 active"><label
                                class="pull-right  control-label">房车</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="homecar" name="homecar" type="text" placeholder="请输入房车信息" th:value="${sysClientYx.homecar}"
                        /></td>



                    </tr>

                    <tr><td class="width-15 active"><label
                            class="pull-right  control-label">户籍地点</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="hujidiqu" name="hujidiqu" type="text" placeholder="请输入户籍地点" th:value="${sysClientYx.hujidiqu}"
                        /></td>

                        <td class="width-15 active"><label
                                class="pull-right  control-label">择偶要求</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="zeouyaoqiu" name="zeouyaoqiu" type="text" placeholder="请输入择偶要求" th:value="${sysClientYx.zeouyaoqiu}"
                                                     /></td>


                    </tr>
                    <tr>
                        <td class="width-15 active"><label
                                class="pull-right  control-label">内心独白</label></td>
                        <td class="width-35"><input class="form-control"
                                                    id="neixindubai" name="neixindubai" type="text" placeholder="请输入内心独白" th:value="${sysClientYx.neixindubai}"
                        /></td>
                    </tr>
                </table>
                <div class="clearfix ">
                    <div class="center">
                        <button class="btn btn-info" type="submit" id="submitBtn">
                            <i class="ace-icon fa fa-check bigger-110"></i> 保存
                        </button>

                        &nbsp; &nbsp; &nbsp;
                        <button class="btn" type="button" id="closeWin">
                            <i class="ace-icon fa fa-del bigger-110"></i> 关闭
                        </button>
                    </div>
                </div>
            </form>
        </div>

    </div>
    <!-- end main container -->
</div>

<div th:replace="common/commonJS"></div>
<script th:src="@{/ace/plugins/chosen/chosen.jquery.min.js}"></script>
<!--<script type="text/javascript">-->
    <!--var myRole=[(${myRole})];-->

    <!--$(document).ready(function(){-->
        <!--$.each(myRole, function(index, value, array) {-->
            <!--$(".chosen-select option[value='"+value.id+"']").attr("selected","selected");-->
        <!--});-->

        <!--$(".chosen-select").chosen();-->

        <!--$("#officeButton, #officeName").click(function(){-->
            <!--// 是否限制选择，如果限制，设置为disabled-->
            <!--if ($("#officeButton").hasClass("disabled")){-->
                <!--return true;-->
            <!--}-->
            <!--// 正常打开-->
            <!--top.layer.open({-->
                <!--type: 2,-->
                <!--area: ['300px', '420px'],-->
                <!--title:"选择机构",-->
                <!--ajaxData:{selectIds: $("#p_Id").val()},-->
                <!--content: ctx+"sys/treeselect?url="+encodeURIComponent("sys/office/treeData")+"&module=&checked=&extId=&isAll=&allowSearch=" ,-->
                <!--btn: ['确定', '关闭']-->
                <!--,yes: function(index, layero){ //或者使用btn1-->
                    <!--var tree = layero.find("iframe")[0].contentWindow.tree;//h.find("iframe").contents();-->
                    <!--var ids = [], names = [], nodes = [];-->
                    <!--if ("" == "true"){-->
                        <!--nodes = tree.get_checked(true);-->
                    <!--}else{-->
                        <!--nodes = tree.get_selected(true);-->
                    <!--}-->
                    <!--for(var i=0; i<nodes.length; i++) {//-->
                        <!--ids.push(nodes[i].id);-->
                        <!--names.push(nodes[i].text);//-->
                        <!--break; // 如果为非复选框选择，则返回第一个选择-->
                    <!--}-->
                    <!--$("#officeId").val(ids.join(",").replace(/u_/ig,""));-->
                    <!--$("#officeName").val(names.join(","));-->
                    <!--$("#officeName").focus();-->
                    <!--top.layer.close(index);-->
                <!--},-->
                <!--cancel: function(index){ //或者使用btn2-->
                    <!--//按钮【按钮二】的回调-->
                <!--}-->
            <!--});-->

        <!--});-->

        <!--$("#officeDelButton").click(function(){-->
            <!--// 是否限制选择，如果限制，设置为disabled-->
            <!--if ($("#officeButton").hasClass("disabled")){-->
                <!--return true;-->
            <!--}-->
            <!--// 清除-->
            <!--$("#officeId").val("");-->
            <!--$("#officeName").val("");-->
            <!--$("#officeName").focus();-->

        <!--});-->

        <!--$("#companyButton, #companyName").click(function(){-->
            <!--// 是否限制选择，如果限制，设置为disabled-->
            <!--if ($("#companyButton").hasClass("disabled")){-->
                <!--return true;-->
            <!--}-->
            <!--// 正常打开-->
            <!--top.layer.open({-->
                <!--type: 2,-->
                <!--area: ['300px', '420px'],-->
                <!--title:"选择区域",-->
                <!--ajaxData:{selectIds: $("#areaId").val()},-->
                <!--content: ctx+"sys/treeselect?url="+encodeURIComponent("sys/office/treeData")+"&module=&checked=&extId=&isAll=&allowSearch=" ,-->
                <!--btn: ['确定', '关闭']-->
                <!--,yes: function(index, layero){ //或者使用btn1-->
                    <!--var tree = layero.find("iframe")[0].contentWindow.tree;//h.find("iframe").contents();-->
                    <!--var ids = [], names = [], nodes = [];-->
                    <!--if ("" == "true"){-->
                        <!--nodes = tree.get_checked(true);-->
                    <!--}else{-->
                        <!--nodes = tree.get_selected(true);-->
                    <!--}-->
                    <!--for(var i=0; i<nodes.length; i++) {//-->
                        <!--ids.push(nodes[i].id);-->
                        <!--names.push(nodes[i].text);//-->
                        <!--break; // 如果为非复选框选择，则返回第一个选择-->
                    <!--}-->
                    <!--$("#companyId").val(ids.join(",").replace(/u_/ig,""));-->
                    <!--$("#companyName").val(names.join(","));-->
                    <!--$("#companyName").focus();-->
                    <!--top.layer.close(index);-->
                <!--},-->
                <!--cancel: function(index){ //或者使用btn2-->
                    <!--//按钮【按钮二】的回调-->
                <!--}-->
            <!--});-->

        <!--});-->

        <!--$("#companyDelButton").click(function(){-->
            <!--// 是否限制选择，如果限制，设置为disabled-->
            <!--if ($("#companyButton").hasClass("disabled")){-->
                <!--return true;-->
            <!--}-->
            <!--// 清除-->
            <!--$("#companyId").val("");-->
            <!--$("#companyName").val("");-->
            <!--$("#companyName").focus();-->

        <!--});-->
    <!--})-->
<!--</script>-->
<script type="text/javascript">
    var defaultImg="[[@{/ace/avatars/profile-pic.jpg}]]";
    function fileSelect() {
        $("#photoImg").click();
    }
    function clearfileSelect(){
        $("#avatar").attr("src",defaultImg);
    }
    function fileSelected(selectedFile) {
        var docObj=document.getElementById("photoImg");
        // 文件选择后触发次函数
        if(docObj.files &&docObj.files[0]){
            $("#avatar").attr("src", window.URL.createObjectURL(docObj.files[0]));
        }
        return true;
    }

    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    //关闭iframe
    $('#closeWin').click(function(){
        top.layer.close(index);
    });

    $().ready(function() {
        $("#clientYxAddForm").validate({
            submitHandler: function(form) {
                //验证通过后 的js代码写在这里

                $(form).ajaxSubmit({
                    dataType:"json",
                    success:function( data ){
                        if(data==1){
                            top.layer.alert('保存成功')
                            top.layer.close(index);
                            top.getActiveTab()[0].contentWindow.search();
                        }else{
                            top.layer.alert('保存失败')
                        }


                    },
                    error:function(xhr, status, error){
                        top.layer.alert('操作失败');
                    }
                });

            }
        });
    });
</script>
</body>
</html>